function F = ComputeDeformation(B, B0)
N = size(B, 1);
if N ~= size(B0, 1)
    error('B and B0 must be the same size');
end

F = zeros(N, 2, 2);

for ii = 1:N
    theta = B(ii,3);
    a = B(ii,4);
    b = B(ii,5);
    
    theta0 = B0(ii,3);
    a0 = B0(ii,4);
    b0 = B0(ii,5);
    
    A = [cos(theta) / a, sin(theta) / a;
         -sin(theta) / b, cos(theta) / b];
    A0 = [cos(theta0) / a0, sin(theta0) / a0;
         -sin(theta0) / b0, cos(theta0) / b0];
    F(ii,:,:) = A \ A0;
end

end

